'''
Test-first Coding Technique
'''

import fuse, screenspec, tdl

class Manager(object):
	'''
	Manager

	Load order:
	- screen spec
	- fuse
	- tdl
	'''

	def __init__(self):
		self.__fuse = None
		self.__screenspec = None
		self.__tdl = None

		self.conf = {
				'fuse': self.__fuse,
				'screenspec': self.__screenspec,
				'tdl': self.__tdl,
		}

	def load_screenspec(self, filename):
		self.__screenspec = screenspec.load(filename)

	def load_fuse(self, filename):
		if self.__screenspec is not None:
			self.__fuse = fuse.load(filename, self.conf)
		else:
			raise Exception("inproper initialization")

	def load_tdl(self, filename):
		if self.__screenspec is not None and self.__fuse is not None:
			self.__tdl = tdl.load(filename, self.conf)
		else:
			raise Exception("inproper initialization")

	def get_fuse(self):
		return self.__fuse